Syntax10.Scn.Fnt Syntax12i.Scn.Fnt Syntax10i.Scn.Fnt ParcElems Alloc Syntax12.Scn.Fnt GreekSyntax12.Scn.Fnt Math12.Scn.Fnt FoldElems StampElems Alloc 2 Jun 96 StyleElems Alloc paragraph paragraph2 new page title abstract table algorithm program LineElems Alloc 2 Jun 96 Syntax10b.Scn.Fnt Courier10.Scn.Fnt EditKeys.Reset EditKeys.Read EditKeys.Text ~ (* for documentation, search for this string: EditKeys 2.0 *) (* programming mail Internal External Documentation *) (* set hot_key to ` *) \ #245 (*built-in functions*) (*taking a parameter*) write (^0) char (^1) font (^2) off (^3) call (^4) arg (^A) exec (^B) param (^C) (*no parameter*) keep (^5) pick (^6) caret (^7) indent (^8) freeze (^9) (*abreviations for built-in function calls*) arg0 ("0" arg) arg1 ("1" arg) arg2 ("2" arg) arg3 ("4" arg) kwrite (keep write) pwrite (pick write) (*some font preset macros*) n ("Syntax10.Scn.Fnt" font) i ("Syntax10i.Scn.Fnt" font) m ("Syntax10m.Scn.Fnt" font) b ("Syntax10b.Scn.Fnt" font) n2 ("Syntax12.Scn.Fnt" font) i2 ("Syntax12i.Scn.Fnt" font) m2 ("Syntax12m.Scn.Fnt" font) b2 ("Syntax12b.Scn.Fnt" font) n4 ("Syntax14.Scn.Fnt" font) i4 ("Syntax14i.Scn.Fnt" font) m4 ("Syntax14m.Scn.Fnt" font) b4 ("Syntax14b.Scn.Fnt" font) mono ("Courier10.Scn.Fnt" font) mono2 ("Courier12.Scn.Fnt" font) math2 ("Math12.Scn.Fnt" font) math4 ("Math14.Scn.Fnt" font) bold ("KeyCmds.Bold" call) (*some template macros for special characters*) | ("`" write) (*enable entry of hotkey character*) tab ("9" char) cr ("13" char) qt ("34" char) sp (" " write) = (cr indent) ` (= tab) del ("127" char) lf ("10" char) a` (" " pwrite) a' (" " pwrite) a^ (" " pwrite) a" (" " pwrite) A" (" " pwrite) e` (" " pwrite) e' (" " pwrite) e^ (" " pwrite) e" (" " pwrite) i` (" " pwrite) i' ("i'" pwrite) i^ (" " pwrite) i" (" " pwrite) o` (" " pwrite) o' ("o'" pwrite) o^ (" " pwrite) o" (" " pwrite) O" (" " pwrite) u` (" " pwrite) u' ("u'" pwrite) u^ (" " pwrite) u" (" " pwrite) U" (" " pwrite) c, (" " pwrite) n~ (" " pwrite) alpha ("a" kwrite) beta ("b" kwrite) gamma ("g" kwrite) delta ("d" kwrite) epsilon ("e" kwrite) zeta ("z" kwrite) eta ("h" kwrite) theta ("q" kwrite) iota ("i" kwrite) kappa ("k" kwrite) lambda ("l" kwrite) mu ("m" kwrite) nu ("n" kwrite) xi ("x" kwrite) omikron ("o" kwrite) pi ("p" kwrite) rho ("r" kwrite) sigma ("s" kwrite) tau ("t" kwrite) ypsilon ("u" kwrite) phi ("j" kwrite) chi ("c" kwrite) psi ("y" kwrite) omega ("w" kwrite) leq ("#" kwrite) geq ("3" kwrite) neq ("9" kwrite) approx (";" kwrite) about ("p" kwrite) begc ("h" kwrite) endc ("i" kwrite) begf ("j" kwrite) endf ("k" kwrite) empty ("F" kwrite) reals ("!" kwrite) nats (" " kwrite) elem ("N" kwrite) notelem ("O" kwrite) subset ("M" kwrite) truesubset ("L" kwrite) dot ("7" kwrite) cart ("4" kwrite) power ("C" kwrite) union ("H" kwrite) sect ("G" kwrite) not ("X" kwrite) and ("Y" kwrite) or ("Z" kwrite) xor ("E" kwrite) impl ("^" kwrite) equiv (":" kwrite) arrow ("." kwrite) tarrow (" " kwrite) beg (" " kwrite) box (" " kwrite) end (" " kwrite) all ("R" kwrite) ex ("S" kwrite) qed ("U" kwrite) forall ("(" write all sp caret sp ")" write) exists ("(" write ex sp caret sp ")" write) (*some vertical offset preset macros*) sup ("16" off) sub ("-16" off) norm ("0" off) [ (sup n) ] (sub n) / (norm n2) (*some macros calling Oberon commands*) d ("StampElems.Insert" call) d1 ("KeyCmds.DateStamp Syntax10.Scn.Fnt" call) id ("StampElems.Insert" call) id1 ("KeyCmds.DateStamp Syntax10i.Scn.Fnt" call) Cn ("EditTools.ChangeStyle ? => ." call) Ci ("EditTools.ChangeStyle ? => i" call) Cb ("EditTools.ChangeStyle ? => b" call) Cm ("EditTools.ChangeStyle ? => m" call) C ("EditTools.ChangeSize ? => 10" call) C2 ("EditTools.ChangeSize ? => 12" call) C4 ("EditTools.ChangeSize ? => 14" call) C6 ("EditTools.ChangeSize ? => 16" call) inc2 ("EditTools.IncSize 2" call) dec2 ("EditTools.IncSize -2" call) save (freeze "KeyCmds.Save" call) . ("KeyCmds.Paste" call) , ("Edit.Recall" call) (*some macros to support various text elements*) parc ("Edit.InsertParc @" call) style ("StyleElems.Insert" arg0 param call) fold (" " pwrite caret " " write) graph ("GraphicElems.Insert" call) pict (" PictElems.Insert Grapes.Pict" call) table ("TableElems.Insert" call) kepler ("KeplerElems.Insert" call) clock ("ClockElems.Insert" call) pop ("PopupElems.Insert" arg0 param call) man ("IconElems.Insert" call) troup (man man man man man man man man man) army (troup troup troup troup troup troup troup troup troup) line ("LineElems.Insert auto 1" call) line2 ("LineElems.Insert auto 2" call) line4 ("LineElems.Insert auto 4" call) line6 ("LineElems.Insert auto 6" call) dline ("LineElems.Insert auto 1 double" call) dline2 ("LineElems.Insert auto 2 double" call) dline4 ("LineElems.Insert auto 4 double" call) dline6 ("LineElems.Insert auto 6 double" call) tline ("LineElems.Insert tab 1" call) tline2 ("LineElems.Insert tab 2" call) tline4 ("LineElems.Insert tab 4" call) tline6 ("LineElems.Insert tab 6" call) fline ("LineElems.Insert 1" arg0 param call) fline2 ("LineElems.Insert 2" arg0 param call) fline4 ("LineElems.Insert 4" arg0 param call) fline6 ("LineElems.Insert 6" arg0 param call) stamp (" " write) (*style element macros*) para (" " write) para2 (" "write) newpage (" " write) title (" " write) abstract (" " write) tablepara (" " write) algorithm (" " write) program (" " write) (*some template macros for programming purposes*) #40 (" (* " write caret " *) " write) (* '(' *) #41 (" (** " write caret " **) " write) (* ')' *) (*[ (" (* " write caret " *) " write) (* '[' ctab! *)*) (*] (" (** " write caret " **) " write) (* ']' ctab! *)*) < (tab "(*<< " write caret " *) " write) << (tab "(*<<*) " write) rd(tab "(*< y THEN RETURN x ELSE RETURN y END END Max; " write) int ("INTEGER;" pwrite) lint ("LONGINT;" pwrite) boo ("BOOLEAN;" pwrite) ptr ("= POINTER TO " pwrite) arr ("ARRAY " pwrite caret " OF ;" pwrite) ret ("RETURN " write) RETURN ("RETURN" write) exit ("EXIT " write) EXIT ("EXIT" write) halt ("HALT(" write caret ")" write) HALT ("HALT" write) assert ("ASSERT(" write caret ")" write) ASSERT ("ASSERT" write) ls ("Log.Str(" pwrite qt caret qt "); " pwrite) li ("Log.Int(" pwrite caret "); " pwrite) ll ("Log.Ln; " pwrite) * (freeze bold) (* shortcuts *) => (arg0 write " => " write caret arg0 write) -> (=>) - (=>) > (=>) decode ("Decoder.Decode " write caret ".Obj" write) code ("AsciiCoder.CodeFiles % " write caret "~" write) ren ("System.RenameFiles " write caret "~" write) rename (ren) delete ("System.DeleteFiles " write caret "~" write) copy ("System.CopyFiles " write caret "~" write) bdir ("Backup.Directory" call) bread ("Backup.ReadFiles " write caret "~" write) bwrite ("Backup.WriteFiles " write caret "~" write) (* some template macros for e-mail addresses *) parc80 (" " write) format80 ("KeyCmds.MarkFocus" call "KeyCmds.ChangeFont Courier10.Scn.Fnt" call "EditTools.ToAscii * " call "EditTools.RemoveElems *" call "EditTools.InsertCR 79 *" call) (*default macro taken when no match found*) (*OTHERWISE ("`" pwrite)*) (*install macro executed after initially loading EditKeys*) INSTALL () EditKeys 2.0 Documentation cas 9 May 92 / mh 19 Apr 94 EditKeys.Open ^ open a user viewer with macro facility EditKeys.SysOpen ^ open a system viewer with macro facility EditKeys.GetKeyHandler put EditKeys.KeyHandle into Oberon.Par.frame.handle if Oberon.Par.pos = -42 EditKeys.Upgrade exchange handle of marked textframe with EditKeys.Handle "Copy Out Tool" for using EditKeys. EditKeys.Definitions EditKeys.Read EditKeys.Text ~ EditKeys.Reset EditKeys.GetKeyCode EditKeys.Definitions opens a viewer and lists all current macro definitions. A selection or a command parameter can be used to restrict the list to definitions with a certain prefix. EditKeys.Read takes a list of files and reads in macro definitions contained therein. If errors are detected, all definitions are deleted. For prototyping macros, it is also possible to have "@" or ":=" as an argument for EditKeys.Read, where @ causes the current selection to be read in, while := takes the text following. (Warning: in both cases the text is parsed to its end.) Upon module load time, the standard macro definition file "EditKeys.Text" is read in. Also, if a macro "INSTALL" is defined, it is invoked. EditKeys.Reset deletes all current macro definitions, resetting the hotkey to its default. EditKeys.GetKeyCode helps to find out the codes of certain keys. Within a text supporting macro keys, entering the hot key causes expansion of the macro entered to the left. To avoid ambiguouties, the longest matching macro name is taken. A macro may have zero or more arguments supplied by the user. If no corresponding definition of a macro is found, a second try is made with the standard macro name "OTHERWISE". (EditKeys.Reset defines "OTHERWISE" to write the default hotkey, i.e. "\".) Syntax of macro definition files for EditKeys. MacroFile = [HotKeyDef] {MacroDef}. HotKeyDef = '\' KeyName. -- sets the macro expansion hot key (default is \) MacroDef = MacroName '(' { MacroName | TextStretch | Command} ')'. MacroName = KeyName | { }. TextStretch = '"' '"'. KeyName = '#' . (Comments and arbitrary white space are allowed between any two terminals. Comments may be nested.) Syntax of macro invocations. MacroInvocation = {Argument ":"} MacroName. Argument = { } | TextStretch. Built-in functions. Text stretches are pushed on a parameter stack when processed. Built-in functions may pop parameter(s) from that stack. ^0 pops a parameter and causes textual insertion. ^1 pops a parameter and inserts the corresponding ascii character. ^2 pops a parameter which must be a font name; presets the named font. ^3 pops a parameter which must be an integer; presets the vertical offset (in 1/64th of font height). ^4 pops a parameter and tries to call it as an Oberon command. ^A pops a parameter which must be an integer; pushs the nth (0 is leftmost one) macro argument ^B pops a parameter which must be a macro name; invokes the named macro ^C pops a parameter and appends it to the parameters used when calling an Oberon command ^5 keeps the font that would have been used w/o macro; presets this font. ^6 picks the font that would have been used w/o macro; forces whole macro to this font. ^7 presets the caret position. ^8 indents the next line according to the last line's indentation. ^9 avoids deletion of the macro, neither inserts characters written by the macro. Remarks. When reading in a macro that has been read in before, the new definition replaces the old one. Cyclic definitions can be constructed this way; a try to process such a definition is prevented.